package mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.bean.HomePostsInfo;
import org.example.bean.MemberInfo;
import org.example.bean.MembershipInfo;
import org.example.bean.UsersInfo;


public interface UsersMapper {
    @Select("select * from users where userPhone=#{phone} and userPass=md5(#{pass})")
    UsersInfo findUsersByPhone(@Param("phone") String phone, @Param("pass") String pass);
    @Update("update users set photo=#{photo} where userId=#{userId}")
    void saveUsers(UsersInfo ui);
    @Select("select * from Member where userId=#{uid}")
    MemberInfo findMemberById(int uid);
    @Select("select * from Membership where id=#{id}")
    MembershipInfo findMembershipById(int id);
    @Insert("INSERT INTO Member VALUES(null,#{userId},0)")
    void saveMember(int userId);
    @Update("update users set id=1 where userId=#{userId}")
    void saveUsersId(int userId);
}
